1. Technical Field
The present disclosure generally relates to debugging, and more specifically to methods and apparatus for interactive debugging on a non-preemptible graphics processing unit (GPU).
2. Description of the Related Art
Conventional debugging tools provide the capability to halt execution of a program at a given point in the program and evaluate the processor context (i.e., memory, registers, etc.) at that point in the program using a user interface of some type, typically a graphical user interface displayed on a monitor coupled to the debugging platform. Typically, debugging tools are categorized as software implementations or hardware implementations.
Software debugging includes many techniques for detecting errors in a program. One technique for debugging a program is to modify the program so that various variable values are written to an alternate location or replace the normal program output during execution of the program. The program is then re-executed to collect the desired output. While such techniques may be beneficial for detecting some types of errors, these techniques have many disadvantages. Requiring a user to execute a modified program may not allow a user to analyze the program in real-time. If the program is not deterministic, then re-executing the program may display inconsistent values for variables. In addition, only trusted parties that have access to the program's source code may perform debugging operations. Further, re-executing the program may require large memory transfers in order to reset state variables, which may introduce additional delays or inconsistencies. Modifying the program may also hide some errors caused by the specific timing of instructions as executed by the system or change the order of the instruction stream generated by the compiler, thereby leading to entirely different results. Further, a user may not be able to analyze the efficiency of the unmodified program to determine where some types of processing bottlenecks are occurring. Another technique based on software debugging implementations may utilize a software emulator to simulate the execution of a program on a targeted platform. The software emulator allows the user to step through instructions and understand the effects of those instructions on a processor context of the targeted platform. However, because the software emulator merely simulates the targeted platform, debugging certain transient errors caused by asynchronous execution of instructions may be difficult using the software emulator. Furthermore, the software emulator may behave differently than the targeted hardware platform due to bugs inherent in the software emulator or tradeoffs between simulation performance and accuracy, thus confounding the debugging issue.
In addition to software debugging tools, many hardware platforms implement various hardware debugging tools that may be used in lieu of or in addition to software debugging techniques. For example, some processors enable hardware breakpoints to be implemented by a debugger that halts the execution of the program on the processor when a specific instruction is executed and waits for a resume command to be issued. Other processors implement some type of debugging port such as a JTAG (Joint Test Action Group) port that enables access to internal debug modules implemented on the integrated circuit of the target platform.
Conventionally, debugging may be implemented via software emulators or via remote debugging that requires a targeted platform connected to a computer that is executing the debugger. One reason for implementing debugging on a target platform that is separate from a development platform is that halting execution of a source program executing on the same platform of the debugger may also halt critical hardware needed to run the debugger. For example, utilizing a breakpoint on a CPU executing a source program may prevent the CPU from running the operating system, thereby preventing the programmer from viewing the state of the CPU or making changes to memory using the software debugging tools.
Accordingly, what is needed in the art is a system and method that allows for interactive debugging of a target GPU while also allowing the target GPU to continue normal screen drawing operations received from the operating system.